package com.hhxy.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.hhxy.model.dto.UserLoginDto;
import com.hhxy.service.LoginService;
import com.hhxy.utils.redis.RedisCache;
import com.hhxy.utils.response.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author ghp
 * @date 2023/4/25
 * @title
 * @description
 */
@Api(tags = {"前台接口", "登录注册"})
@ApiSupport(author = "ghp", order = 1)
@RestController
@RequestMapping
public class FeLoginController {

    @Resource
    private LoginService loginService;

    @Resource
    private RedisCache redisCache;

    @PostMapping("/login")
    @ApiOperation(value = "用户登录")
    @ApiOperationSupport(author = "ghp", order = 1)
    public ResponseResult login(@RequestBody UserLoginDto userLoginDto) {
        return loginService.login(userLoginDto);
    }

    @PostMapping("/logout")
    @ApiOperation(value = "用户退出")
    @ApiOperationSupport(author = "ghp", order = 1)
    public ResponseResult logout() {
        return loginService.logout();
    }

}
